package com.ylbh.modules.home.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ylbh.common.pojo.home.vo.*;
import com.ylbh.modules.business.entity.ShoppingUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface HomeMapper extends BaseMapper<ShoppingUser> {

    /**
     * 首页-待处理事务
     * @return
     */
//    List<HomeToBeProcessedVO> selectToBeProcessed();
    List<Integer> selectToBeProcessed();

    /**
     * 查询销售额
     * @param nearlySevenDays
     * @param yesterday
     * @param date
     * @return
     */
    HomeDataOverviewVO selectSalesVolume(@Param(value = "nearlySevenDays") String nearlySevenDays,
                                         @Param(value = "yesterday")String yesterday,
                                         @Param(value = "date")String date,
                                         @Param(value = "date1")String date1);

    /**
     * 首页-商城商品信息
     * @param format
     * @return
     */
    List<HomeMallInformationVO> selectMallInformation(String date);

    /**
     * 订单来源-商城
     * @return
     */
    List<HomeSourceOfOrderVO> selectShoppingMallSourceOfOrder(String startTime, String endTime, Integer aTurnoverType);

    /**
     * 订单来源-联盟店
     * @return
     */
    List<HomeSourceOfOrderVO> selectBusinessSourceOfOrder(String startTime, String endTime, Integer aTurnoverType);

    /**
     * 订单类型-商城
     * @return
     */
    List<HomeSourceOfOrderVO> selectShoppingMallOrderType(String startTime, String endTime, Integer aTurnoverType);

    /**
     * 订单类型-联盟店
     * @return
     */
    List<HomeSourceOfOrderVO> selectBusinessOrderType(String startTime, String endTime, Integer aTurnoverType);

    /**
     * 商城订单-用户类型
     * @return
     */
    List<HomeSourceOfOrderVO> selectShoppingMallUserType(String startTime, String endTime, Integer aTurnoverType);

    /**
     * 联盟店订单-用户类型
     * @return
     */
    List<HomeSourceOfOrderVO> selectBusinessUserType(String startTime, String endTime, Integer aTurnoverType);

    /**
     * 商城-查询环比和同比
     * @param time
     * @param chainRatio
     * @param yearOnYear
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectShoppingMallTrendAll(String time, String chainRatio, String yearOnYear);

    /**
     * 商城-只查询环比
     * @param time
     * @param chainRatio
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectShoppingMallTrendChainRatio(String time, String chainRatio);

    /**
     * 商城-只查询同比
     * @param time
     * @param yearOnYear
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectShoppingMallTrendYearOnYear(String time, String yearOnYear);

    /**
     * 商城-只查询默认的
     * @param time
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectShoppingMallTrend(String time);

    /**
     * 联盟店-查询环比和同比
     * @param time
     * @param chainRatio
     * @param yearOnYear
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectBusinessTrendAll(String time, String chainRatio, String yearOnYear);

    /**
     * 联盟店-只查询环比
     * @param time
     * @param chainRatio
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectBusinessTrendChainRatio(String time, String chainRatio);

    /**
     * 联盟店-只查询同比
     * @param time
     * @param yearOnYear
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectBusinessTrendYearOnYear(String time, String yearOnYear);

    /**
     * 联盟店-只查询默认的
     * @param time
     * @return
     */
    List<HomeSingleQuantityTrendVO> selectBusinessTrend(String time);

    /**
     * 商城热销商品排行
     * @param startTime
     * @param endTime
     * @param type
     * @param sortType
     * @return
     */
    List<HomeConsumptionRankingVO> selectShoppingMallSellWell(String startTime, String endTime, Integer type, Boolean sortType);

    /**
     * 商城商品滞销排行
     * @param startTime
     * @param endTime
     * @param type
     * @param sortType
     * @return
     */
    List<HomeConsumptionRankingVO> selectShoppingMallUnsalable(String startTime, String endTime, Integer type, Boolean sortType);

    /**
     * 商城商品成交转化排行
     * @param startTime
     * @param endTime
     * @param type
     * @param sortType
     * @return
     */
    List<HomeConsumptionRankingVO> selectConversion(String startTime, String endTime, Integer type, Boolean sortType);

    /**
     * 查询出对应商品的购买数量及加入购物车的数量
     * @param conversionRate
     * @return
     */
    List<Integer> selectGoodsConversion(String conversionRate);

    /**
     * 联盟店销量排行
     * @param startTime
     * @param endTime
     * @param type
     * @param sortType
     * @return
     */
    List<HomeConsumptionRankingVO> selectBusinessSalesVolume(String startTime, String endTime, Integer type, Boolean sortType);

    /**
     * 热搜排行
     * @param startTime
     * @param endTime
     * @return
     */
    List<HomeConsumptionRankingVO> selectSearchVolume(String startTime, String endTime);

    /**
     * 会员商城排行
     * @param startTime
     * @param endTime
     * @param sortType
     * @return
     */
    List<HomeConsumptionRankingVO> selectShoppingMallMembershipConsumption(String startTime, String endTime, Boolean sortType);

    /**
     * 会员联盟店消费排行
     * @param startTime
     * @param endTime
     * @param sortType
     * @return
     */
    List<HomeConsumptionRankingVO> selectBusinessMembershipConsumption(String startTime, String endTime, Boolean sortType);

    /**
     * 复购率统计
     * @param startTime
     * @param endTime
     * @return
     */
    List<Integer> selectRepeatPurchase(String startTime,  String endTime);

    /**
     * 查询有同比或者环比的分类销量
     * @param dayStart
     * @param dayEnd
     * @param thanStart
     * @param thanEnd
     * @param gcId
     * @return
     */
    List<ClassifiedSalesVO> selectClassifiedSalesThan(String startTime, String endTime, String thanStart, String thanEnd, Integer gcId);

    /**
     * 查询所有数据
     * @param dayStart
     * @param dayEnd
     * @param thanStart
     * @param thanEnd
     * @param yearOrYearStartTime
     * @param yearOrYearEndTime
     * @param gcId
     * @return
     */
    List<ClassifiedSalesVO> selectClassifiedSalesAll(String dayStart, String dayEnd, String thanStart, String thanEnd, String yearOrYearStartTime, String yearOrYearEndTime, Integer gcId);

    /**
     * 只查询当前单量
     * @param dayStart
     * @param dayEnd
     * @param gcId
     * @return
     */
    List<ClassifiedSalesVO> selectSingleVolume(String dayStart, String dayEnd, Integer gcId);

    /**
     * 联盟店积分走势
     * @param time
     * @param income
     * @param expenditure
     * @return
     */
    List<BusinessIntegralVO> queryBusinessIntegral(String time, String thanTime, Boolean income, Boolean expenditure);
}
